<template>
  <div>
    <!-- 热门品牌 -->
    <Panel title="热门品牌" sub-title="国际经典 品质保证">
      <template #main>
        <ul class="brand-list">
          <li v-for="item in brandList" :key="item.id">
            <nuxt-link to="/">
              <img :src="item.picture" alt="" />
            </nuxt-link>
          </li>
        </ul>
      </template>
    </Panel>
  </div>
</template>

<script>
export default {
  name: 'HomeBrand',
  components: {},
  props: {},
  data() {
    return {
      brandList: []
    }
  },
  async fetch() {
    await this.getBrand()
  },
  mounted() {},
  methods: {
    /** 获取热门品牌 */
    async getBrand() {
      const { data: res } = await this.$getBrand(5)
      if (res.code !== '1') return this.$message.error(res.msg)
      this.brandList = res.result
    }
  }
}
</script>

<style scoped lang="scss">
.brand-list {
  display: flex;
  justify-content: space-between;
  height: 305px;

  li {
    width: 240px;
    height: 305px;

    img {
      width: 306px;
      height: 306px;
    }
  }
}
</style>
